<template>
  <el-dialog :title="title" :visible.sync="visible" width="500px" append-to-body>
    <el-form ref="form" inline :model="form" :rules="rules" label-width="170px">
    <!--  基础信息    -->
      <el-form-item label="信用金额" prop="creditAmount">
        <el-input
          v-model="form.creditAmount"
          placeholder="信用金额"
          clearable
          style="width: 240px"
        />
      </el-form-item>

    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="submitForm">确 定</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>
</template>

<script>
import {updateAmount, getById} from "@/api/system/organization";

export default {
  name: "updateamount",
  data() {
    return {
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      visible: false,
      // 表单参数
      form: {
        "orgId": '',
        "creditAmount": ''
      },
      autoConfirmFlag: [],
      // 表单校验
      rules: {
        activeInd: [
        ]
      }
    }
  },
  methods: {
    open(id) {
      this.visible = true
      console.log(id)
      if (id) {
        getById(id).then(response => {
          this.visible = true
          this.$nextTick(() => {
            this.form = response.data
          })
          this.title = "修改"
        })
      }
    },
    /** 提交按钮 */
    submitForm() {
      updateAmount(this.form).then(response => {
        this.$modal.msgSuccess("修改成功")
        this.visible = false
        this.$emit('confirm')
      })
    },
    // 取消按钮
    cancel() {
      this.visible = false
      this.reset()
    },
    // 表单重置
    reset() {
      this.$refs.form.resetFields()
    },
  }
}
</script>
<style lang="scss" scoped>
.titleDiv{
  color: #1E5494;
  margin-left: 30px;
}
</style>
